package SqlDatabase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBHelper extends SQLiteOpenHelper {
	  private final static String DATABASE_NAME = "friend_Info";
	  private final static int DATABASE_VERSION = 1;
	   
    DBHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    	String sql = "create table tb_friend(" +
    					"code integer primary key autoincrement," +
    					"name text not null, birth datetime not null," +
    					"live text not null, job text not null," +
    					"hobby text not null";
    	db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      db.execSQL("drop table if exist tb_friend");
      onCreate(db);
    }
}
